class StockSpanner(object):

    def __init__(self):
        self.st = [10 ** 5 + 1]
        self.day_st = [0]
        self.index = 1

    def next(self, price):
        """
        :type price: int
        :rtype: int
        """
        while self.st[-1] <= price:
            self.st.pop()
            self.day_st.pop()
        self.st.append(price)
        self.day_st.append(self.index)
        self.index += 1
        return self.day_st[-1] - self.day_st[-2]


